<cds-modal size="sm"
           [open]="open"
           (overlaySelected)="closeModal()">
  <cds-modal-header (closeSelect)="closeModal()">
    <h3 cdsModalHeaderHeading
        i18n>Move an image to trash</h3>
  </cds-modal-header>

  <section cdsModalContent>
    <form name="moveForm"
          class="form"
          #formDir="ngForm"
          [formGroup]="moveForm"
          novalidate>
      <cd-alert-panel type="warning"
                      *ngIf="hasSnapshots"
                      spacingClass="mb-2">
        <span i18n>This image contains snapshot(s), which will prevent it
          from being removed after moved to trash.</span>
      </cd-alert-panel>

      <p i18n>To move <kbd>{{ imageSpecStr }}</kbd> to trash,
        click <kbd>Move</kbd>. Optionally, you can pick an expiration date.</p>
      <div class="form-item">
        <cds-checkbox formControlName="setExpiry"
                      id="setExpiry"
                      name="setExpiry"
                      (checkedChange)="toggleExpiration()"
                      modal-primary-focus
                      i18n>Set expiration date</cds-checkbox>
      </div>
      <div class="form-item"
           *ngIf="setExpirationDate">
        <cd-date-time-picker [control]="moveForm.get('expiresAt')"
                             name="Protection expires at"
                             i18n-name></cd-date-time-picker>

        <span class="invalid-feedback"
              *ngIf="moveForm.showError('expiresAt', formDir, 'format')"
              i18n>Wrong date format. Please use "YYYY-MM-DD HH:mm:ss".</span>
        <span class="invalid-feedback"
              *ngIf="moveForm.showError('expiresAt', formDir, 'expired')"
              i18n>Protection has already expired. Please pick a future date or leave it empty.</span>
      </div>
    </form>
  </section>

  <cd-form-button-panel (submitActionEvent)="moveImage()"
                        [form]="moveForm"
                        [submitText]="actionLabels.MOVE"
                        [modalForm]="true"></cd-form-button-panel>
</cds-modal>
